#pragma once

#include "../app_status_bar_conf.h"

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#if STATUS_BAR_USE_APP_MANAGER
#include "app_manager.h"
#endif
#if STATUS_BAR_USE_TOPIC_MESSENGER
#include "topic_messenger.h"
#endif
#include "math.h"

typedef enum
{
    STATUS_BAR_HIDDEN = 0,
    STATUS_BAR_INFO,
    STATUS_BAR_EXPAND,
} app_status_bar_expand_t;

typedef struct
{
    lv_obj_t *scr;
    lv_obj_t *bar_left;
    lv_obj_t *bar_right;
#if STATUS_BAR_USE_NOTIFICATION
    lv_obj_t *notification;
    lv_obj_t *info_clear;
#endif
#if STATUS_BAR_USE_CONTROL_CENTER
    lv_obj_t *control_center;
#endif
#if STATUS_BAR_USE_TIME
    lv_obj_t *time;
    lv_obj_t *date;
#endif
#if STATUS_BAR_USE_BATTERY_CHARGE
    lv_obj_t *charge;
#endif
#if STATUS_BAR_USE_BATTERY
    lv_obj_t *bat;
#endif
#if STATUS_BAR_USE_WIFI
    lv_obj_t *wifi;
#endif
#if STATUS_BAR_USE_BT
    lv_obj_t *bt;
#endif

#if STATUS_BAR_USE_CONTROL_CENTER
#if STATUS_BAR_USE_BRIGHTNESS
    lv_obj_t *brightness;
#endif
#if STATUS_BAR_USE_VOLUME
    lv_obj_t *volume;
#endif
#if STATUS_BAR_USE_WIFI_AP
    lv_obj_t *wifi_ap;
#endif
#if STATUS_BAR_USE_WIFI_SWITCH
    lv_obj_t *wifi_switch;
#endif
#if (STATUS_BAR_USE_FLASHLIGHT && !STATUS_BAR_FLASH_LIGHT_USE_SCREEN)
    lv_obj_t *flashlight;
#endif
#if STATUS_BAR_USE_AIRPLANE_MODE
    lv_obj_t *airplane_mode;
#endif
#if STATUS_BAR_USE_BT_SWITCH
    lv_obj_t *bt_switch;
#endif
#if STATUS_BAR_USE_WIFI_LIST
    lv_obj_t *wifi_list;
#endif
#if STATUS_BAR_USE_BT_LIST
    lv_obj_t *bt_list;
#endif
#if STATUS_BAR_USE_MUSIC
    lv_obj_t *music;
#endif
#endif

#if (STATUS_BAR_USE_NOTIFICATION || STATUS_BAR_USE_CONTROL_CENTER)

    lv_dir_t dir;
    lv_coord_t pressed_cache;
    uint8_t scrolled : 1;
    lv_timer_t *page_timer;
#endif
    lv_obj_t *touch_bar;
    lv_obj_t *focus_page;

    lv_timer_t *hid_timer;
    lv_point_t pressed_point;

    app_status_bar_expand_t expand;
    uint8_t full_screen_en;
} app_status_bar_scr_objs_t;

app_status_bar_scr_objs_t *app_status_bar_get_objs();
